
package cn.edu.scau.cmi.hombio.service;

import cn.edu.scau.cmi.hombio.domain.CureTaskCourse;
import cn.edu.scau.cmi.hombio.domain.CureTaskMedicine;
import cn.edu.scau.cmi.hombio.domain.CureTaskMethod;
import cn.edu.scau.cmi.hombio.domain.CureType;

import java.util.List;
import java.util.Set;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;

import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Class to run the service as a JUnit test. Each operation in the service is a separate test.
 *
 */

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({
		DependencyInjectionTestExecutionListener.class,
		DirtiesContextTestExecutionListener.class,
		TransactionalTestExecutionListener.class })
@ContextConfiguration(locations = {
		"file:./resources/pigRs-security-context.xml",
		"file:./resources/pigRs-service-context.xml",
		"file:./resources/pigRs-dao-context.xml",
		"file:./resources/pigRs-web-context.xml" })
@Transactional
public class CureTaskMethodServiceTest {

	/**
	 * The Spring application context.
	 *
	 */
	@SuppressWarnings("unused")
	private ApplicationContext context;

	/**
	 * The service being tested, injected by Spring.
	 *
	 */
	@Autowired
	protected CureTaskMethodService service;

	/**
	 * Instantiates a new CureTaskMethodServiceTest.
	 *
	 */
	public CureTaskMethodServiceTest() {
		setupRequestContext();
	}

	/**
	 * Operation Unit Test
	* Delete an existing CureType entity
	* 
	 */
	@Test
	public void deleteCureTaskMethodCureType() {
		// TODO: JUnit - Populate test inputs for operation: deleteCureTaskMethodCureType 
		Integer curetaskmethod_id = 0;
		Integer related_curetype_id = 0;
		CureTaskMethod response = null;
		response = service.deleteCureTaskMethodCureType(curetaskmethod_id, related_curetype_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteCureTaskMethodCureType
	}

	/**
	 * Operation Unit Test
	* Save an existing CureTaskMethod entity
	* 
	 */
	@Test
	public void saveCureTaskMethod() {
		// TODO: JUnit - Populate test inputs for operation: saveCureTaskMethod 
		CureTaskMethod curetaskmethod = new cn.edu.scau.cmi.hombio.domain.CureTaskMethod();
		service.saveCureTaskMethod(curetaskmethod);
	}

	/**
	 * Operation Unit Test
	* Delete an existing CureTaskMedicine entity
	* 
	 */
	@Test
	public void deleteCureTaskMethodCureTaskMedicines() {
		// TODO: JUnit - Populate test inputs for operation: deleteCureTaskMethodCureTaskMedicines 
		Integer curetaskmethod_id_1 = 0;
		Integer related_curetaskmedicines_id = 0;
		CureTaskMethod response = null;
		response = service.deleteCureTaskMethodCureTaskMedicines(curetaskmethod_id_1, related_curetaskmedicines_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteCureTaskMethodCureTaskMedicines
	}

	/**
	 * Operation Unit Test
	* Delete an existing CureTaskMethod entity
	* 
	 */
	@Test
	public void deleteCureTaskMethod() {
		// TODO: JUnit - Populate test inputs for operation: deleteCureTaskMethod 
		CureTaskMethod curetaskmethod_1 = new cn.edu.scau.cmi.hombio.domain.CureTaskMethod();
		service.deleteCureTaskMethod(curetaskmethod_1);
	}

	/**
	 * Operation Unit Test
	* Load an existing CureTaskMethod entity
	* 
	 */
	@Test
	public void loadCureTaskMethods() {
		Set<CureTaskMethod> response = null;
		response = service.loadCureTaskMethods();
		// TODO: JUnit - Add assertions to test outputs of operation: loadCureTaskMethods
	}

	/**
	 * Operation Unit Test
	* Save an existing CureTaskCourse entity
	* 
	 */
	@Test
	public void saveCureTaskMethodCureTaskCourse() {
		// TODO: JUnit - Populate test inputs for operation: saveCureTaskMethodCureTaskCourse 
		Integer id = 0;
		CureTaskCourse related_curetaskcourse = new cn.edu.scau.cmi.hombio.domain.CureTaskCourse();
		CureTaskMethod response = null;
		response = service.saveCureTaskMethodCureTaskCourse(id, related_curetaskcourse);
		// TODO: JUnit - Add assertions to test outputs of operation: saveCureTaskMethodCureTaskCourse
	}

	/**
	 * Operation Unit Test
	* Save an existing CureType entity
	* 
	 */
	@Test
	public void saveCureTaskMethodCureType() {
		// TODO: JUnit - Populate test inputs for operation: saveCureTaskMethodCureType 
		Integer id_1 = 0;
		CureType related_curetype = new cn.edu.scau.cmi.hombio.domain.CureType();
		CureTaskMethod response = null;
		response = service.saveCureTaskMethodCureType(id_1, related_curetype);
		// TODO: JUnit - Add assertions to test outputs of operation: saveCureTaskMethodCureType
	}

	/**
	 * Operation Unit Test
	* Save an existing CureTaskMedicine entity
	* 
	 */
	@Test
	public void saveCureTaskMethodCureTaskMedicines() {
		// TODO: JUnit - Populate test inputs for operation: saveCureTaskMethodCureTaskMedicines 
		Integer id_2 = 0;
		CureTaskMedicine related_curetaskmedicines = new cn.edu.scau.cmi.hombio.domain.CureTaskMedicine();
		CureTaskMethod response = null;
		response = service.saveCureTaskMethodCureTaskMedicines(id_2, related_curetaskmedicines);
		// TODO: JUnit - Add assertions to test outputs of operation: saveCureTaskMethodCureTaskMedicines
	}

	/**
	 * Operation Unit Test
	 */
	@Test
	public void findCureTaskMethodByPrimaryKey() {
		// TODO: JUnit - Populate test inputs for operation: findCureTaskMethodByPrimaryKey 
		Integer id_3 = 0;
		CureTaskMethod response = null;
		response = service.findCureTaskMethodByPrimaryKey(id_3);
		// TODO: JUnit - Add assertions to test outputs of operation: findCureTaskMethodByPrimaryKey
	}

	/**
	 * Operation Unit Test
	* Return all CureTaskMethod entity
	* 
	 */
	@Test
	public void findAllCureTaskMethods() {
		// TODO: JUnit - Populate test inputs for operation: findAllCureTaskMethods 
		Integer startResult = 0;
		Integer maxRows = 0;
		List<CureTaskMethod> response = null;
		response = service.findAllCureTaskMethods(startResult, maxRows);
		// TODO: JUnit - Add assertions to test outputs of operation: findAllCureTaskMethods
	}

	/**
	 * Operation Unit Test
	* Return a count of all CureTaskMethod entity
	* 
	 */
	@Test
	public void countCureTaskMethods() {
		Integer response = null;
		response = service.countCureTaskMethods();
		// TODO: JUnit - Add assertions to test outputs of operation: countCureTaskMethods
	}

	/**
	 * Operation Unit Test
	* Delete an existing CureTaskCourse entity
	* 
	 */
	@Test
	public void deleteCureTaskMethodCureTaskCourse() {
		// TODO: JUnit - Populate test inputs for operation: deleteCureTaskMethodCureTaskCourse 
		Integer curetaskmethod_id_2 = 0;
		Integer related_curetaskcourse_id = 0;
		CureTaskMethod response = null;
		response = service.deleteCureTaskMethodCureTaskCourse(curetaskmethod_id_2, related_curetaskcourse_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteCureTaskMethodCureTaskCourse
	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Sets Up the Request context
	 *
	 */
	private void setupRequestContext() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
	}
}
